<template>
    <div>
        <search-title></search-title>
         <section class="wrap aboutMe">
            <template>
            <el-tabs :tab-position="tabPosition" v-model="activeName" @tab-click="handleClick">
                <userHead></userHead>
                <el-tab-pane label="消息" name="msg" :lazy="true">
                    <loading v-if="newsShow" loadingStyle="height: 700px"></loading>
                    <news @newsSuccess="newshide"></news>
                </el-tab-pane>
                <el-tab-pane label="账号设置" name="setting" :lazy="true">
                    <!-- <loading v-if="numberShow" loadingStyle="height: 700px"></loading> -->
                    <!-- <userHead></userHead> -->
                    <accountNumber @numberSuccess="numbershide"></accountNumber>
                </el-tab-pane>
                <el-tab-pane label="个人资料" name="data" :lazy="true">
                    <!-- <userHead></userHead> -->
                    <userMsg></userMsg>
                </el-tab-pane>
                <el-tab-pane label="收藏夹" name="collect" :lazy="true">
                    <!-- <userHead></userHead> -->
                    <collection></collection>
                </el-tab-pane>
                <el-tab-pane label="上传记录" name="upload" :lazy="true">
                    <!-- <userHead></userHead> -->
                    <upload-record></upload-record>
                </el-tab-pane>
                <el-tab-pane label="下载记录" name="download" :lazy="true">
                    <!-- <userHead></userHead> -->
                    <download></download>
                </el-tab-pane>
                <el-tab-pane label="提现" name="withdraw" :lazy="true">
                    <!-- <userHead></userHead> -->
                    <cash></cash>
                </el-tab-pane>
            </el-tabs>
            </template>
        </section>
    </div>
</template>
<script>

import {mapState,mapMutations,mapGetters,mapActions} from 'vuex';
import loading from '../loading'
export default {
    name : "userCore",
    data () {
        return {
            msg : "jdslajfdlas",
            tabPosition: 'left',
            activeName: this.$route.query.activeName||'msg',
            indexMsg : null,
            title : "我的消息_集设网",
            newsShow: true,//消息页loading
            numberShow: true,//账号设置页loading
        }
    },
    components: {
        loading,
        news : resolve => require(["./userChild/news"], resolve),//消息组件
        accountNumber : resolve => require(["./userChild/accountNumber"], resolve),//账号设置
        userHead : resolve => require(["./userChild/userHead"], resolve),//统一的头部
        userMsg : resolve => require(["./userChild/userMsg"], resolve),//个人资料
        collection : resolve => require(["./userChild/collection"], resolve),//收藏
        uploadRecord : resolve => require(["./userChild/uploadRecord"], resolve),//上传
        download : resolve => require(["./userChild/download"], resolve),//下载组件
        cash : resolve => require(["./userChild/cash"], resolve),//提现
        searchTitle : resolve => require(["../searchTitle/searchTitle"], resolve)//搜索头部
    },
    computed: {
        ...mapState({//登录的用户信息
            user: state => state.AuthUser
        }),
        mismatchError() {
            return this.bag.has('password:auth') && !this.errors.has('password')
        },
    },
    created(){//请求首页数据
        var locatUrlIndex = window.location.hash.indexOf('?');
        var locatUrl = window.location.hash.slice(locatUrlIndex+1).split('&').join("=").split("=");
       
        if(locatUrl[1]){
            this.activeName = locatUrl[1];
        }
        
    },
    methods:{
        newshide(){//消息loading隐藏
            this.newsShow = false;
        },
        numbershide(){//账号设置loading隐藏
            this.numberShow = false;
        },
        handleClick(tab,event){
            if(tab.name=="msg"){
                this.title = "我的消息_集设网"
            }else if(tab.name=="upload"){
                this.title = "上传记录_集设网"
            }else if(tab.name=="download"){
                this.title = "下载记录_集设网"
            }else if(tab.name=="setting"){
                this.title = "账号设置_集设网"
            }else if(tab.name=="data"){
                this.title = "个人资料_集设网"
            }else if(tab.name=="collect"){
                this.title = "我的收藏_集设网"
            }else if(tab.name=="withdraw"){
                this.title = "提现记录_集设网"
            }
        }
    },
    metaInfo () {
      return {
        title: this.title,
        
      }
    },
    
}
</script>
<style>
    .aboutMe{
        margin-top: 15px;
        margin-bottom: 33px;
        padding-top:71px;
    }
   .aboutMe .el-tabs__header{
        width: 270px;
        height: 330px!important;
        background: #fff!important;
        text-align: left!important;
        padding-top: 4px;
    }
    .el-tabs--left .el-tabs__item.is-left{
        text-align: left!important;
        border-left: 2px solid #fff!important;
    }
    .el-tabs--left .el-tabs__item:hover{
        color: #fff!important;
        border-left: none!important;
        background: #ea514b!important;
    }
    .aboutMe .is-active{
        border-left: 2px solid #ea514b!important;
    }
    .el-tabs__item{
        line-height: 40px;
        height: 46px;
        padding: 0 25px;
    }
    .el-tabs__item.is-active{
        color: #ea514b!important;
    }
    .aboutMe .el-tabs__nav .el-tabs__item.is-active{
       
        border-left: 2px solid #ea514b!important;
    }
    .el-tabs--left .el-tabs__active-bar.is-left, .el-tabs--left .el-tabs__nav-wrap.is-left::after{
        left:0;
        
    }
    .el-tabs__nav-wrap::after{
        background: transparent;
    }
    .el-tabs__active-bar{
        display: none;
    }
    .el-tabs--left .el-tabs__header.is-left{
        margin-right: 15px;
    }



    .newsHead{
        height: 137px;
        background: #fff;
        padding: 32px 31px 0 38px;
        box-sizing: border-box;
        margin-bottom: 17px;
    }
    .headLeft,.newsHeadImg,.newsHeadInfo{
        float: left;
    }
    .newsHeadInfo{
        /* margin-top: 8px; */
        margin-left: 10px;
    }
    .newsHeadImg img{
        width: 76px;
        height: 76px;
        border-radius: 38px;
    }
    .userName{
        font-size: 18px;
        line-height: 32px;
        color: #333333;
    }
    .vipTime{
        font-size: 14px;
        line-height: 20px;
        color: #686868;

    }
    .userMsgCodeId{
        font-size: 16px;
        line-height: 26px;
        color: #333;
    }
    .userMsgCodeId span{
        margin-right: 15px;
    }
    
    .headRight{
        float: right;
    }
    .headRight{
        font-size: 14px;
        line-height: 22px;
        color: #3d3d3d;
        text-align: right;
    }
    .headRight p{
        margin-bottom: 7px;
    }
    .notice{
        height: 185px;
        background: #fff;
        margin-bottom: 15px;
    }
    .notice header{
        font-size: 16px;
        line-height: 66px;
        color: #333333;
        padding-left: 50px;
        border-bottom: 1px solid #dddddd;
        font-weight: bold;
    }
    .noticeList{
        width: 860px;
        margin: 0 auto;
    }
    .noticeList li{
        font-size: 16px;
        line-height: 56px;
        color: #525252;
        padding-left: 13px;
        cursor: pointer;
    }
    .noticeList li:nth-of-type(1){
        border-bottom: 1px dashed #dddddd;
    }
    .read{
        /* display: inline-block; */
        width: 24px;
        height: 21px;
        margin-right:14px;
        font-size: 20px;
        color: #999999;
        /* vertical-align: middle; */
        /* background: url(../../../img/newsRead.png) no-repeat; */
    }
    .newsListLeft{
        float: left;
    }
    .newsListRight{
        float: right;
    }
    /* .newsListRight span{
        display: inline-block;

    } */
    .newsListRight span:nth-of-type(1){
        margin-right: 23px;
    }
    .newsListRight span:nth-of-type(2){
        margin-right: 35px;
    }
    .news{
        height: 554px;
    }
    .newsList li{
        border-bottom: 1px dashed #dddddd;
    }
    .newsList li:last-of-type{
        border: none;
    }
    .unRead{
        color: #ea514b;
        margin-right: 12px;
        /* background: url(../../../img/newsUnRead.png) no-repeat; */
    }
</style>